<!DOCTYPE html>
<html>
<head>
    <title>我要提问</title>
    <meta charset="utf-8"/>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <link href="/css/question/style.css" rel="stylesheet" type="text/css"/>
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/tab.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/plugins/jquery-form/jquery.form.js"></script>
    <script src="/js/common.js"></script>

    <script>
        $(function () {
            var userStr = sessionStorage.getItem("user");
            var user;
            if (userStr) {
                user = JSON.parse(userStr);
                $("#userId").val(user.id);
            }

            $("#saveBtn").click(function () {

                $("#editForm").ajaxSubmit(function (data) {
                    if (data.success) {
                        $(document).dialog({
                            type: 'notice',
                            infoText: '发布成功,请耐心等待驴友的回应~',
                            autoClose: 2500,
                            position: 'bottom'  // center: 居中; bottom: 底部
                        });
                        location.href="/mine/question.html";
                    }
                })
            });
        })
    </script>


</head>

<body>

<section class="aui-flexView">
    <header class="aui-navBar aui-navBar-fixed">
        <a href="/mine/question.html" class="aui-navBar-item">
            <i class="fa fa-angle-left fa-2x"></i>
        </a>
        <div class="aui-center">
            <span class="aui-center-title">我的提问</span>
        </div>
    </header>
    <section class="aui-scrollView">

        <br/>

        <form class="form-horizontal" action="/questions/question" method="post" id="editForm">
            <input type="hidden" name="user.id" id="userId"/>
            <div class="form-group">
                <div class="form-group col-lg-6">
                    <label class="col-sm-4 control-label">标题：</label>
                    <input type="text" name="title" class="form-control" placeholder="请输入标题" width="100%"/>
                </div>
                <div class="col-lg-6">
                    <label class="col-sm-4 control-label">内容：</label>
                    <textarea class="form-control" rows="15" name="detail"></textarea>
                    <br/>
                    <button class="btn btn-success btn-sm btn-block" type="button" id="saveBtn">提交</button>
                </div>
            </div>
        </form>
    </section>
</section>
</body>
</html>